{include file="public/_header"}
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">选择用户:</label>
                    <div class="layui-input-inline">
                        <select name="userId" id="userId" class="layui-select">
                            <option value="">--请选择--</option>
                            {volist name="adminList" id="admin"}
                                <option value="{$admin.id}">{$admin.user_name}({$admin.name})</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">开始时间:</label>
                    <div class="layui-input-inline">
                        <input name="startTime" id="startTime" readonly class="layui-input" placeholder="请选择开始时间">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">结束时间:</label>
                    <div class="layui-input-inline">
                        <input name="endTime" id="endTime" readonly class="layui-input" placeholder="请选择结束时间">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">关键词:</label>
                    <div class="layui-input-inline">
                        <input name="keyword" id="keyword" class="layui-input" placeholder="请输入关键词">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn icon-btn" id="query" lay-filter="loginRecordTbSearch" lay-submit="">
                        <i class="layui-icon"></i>搜索
                    </button>&nbsp;
                </div>
            </div>
            <table id="tableContainer" lay-filter="tableContainer"></table>
        </div>
    </div>
</div>
{include file="public/_footer"}
<script>
    layui.use(['layer', 'admin', 'table','laydate'], function () {
        var $ = layui.jquery;
        var table = layui.table;
        var laydate = layui.laydate;

        laydate.render({
            elem: '#startTime',
            isInitValue: true
        });
        laydate.render({
            elem: '#endTime',
            isInitValue: true
        });

        $('#query').click(function () {
            initTable();
        });

        initTable();

        function initTable() {
            var url = "{:url('getData')}?userId=" + $('#userId').val() + '&startTime=' + $('#startTime').val()
                    + '&endTime=' + $('#endTime').val() + '&keyword=' + $('#keyword').val();
            var insTb = table.render({
                elem: '#tableContainer',
                url: url,
                page: true,
                cellMinWidth: 100,
                cols: [[
                    {field: 'id', title: 'ID'},
                    {field: 'adminName', title: '操作人'},
                    {field: 'title', title: '角色名称'},
                    {field: 'ip', title: '操作IP'},
                    {field: 'create_time', title: '操作时间'},
                ]]
            });
        }
    });
</script>